package com.hmkj.core.mapper.investor;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.model.investor.InvestorModel;
import com.hmkj.core.po.investor.Investor;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 投资人表相关Dao接口<br>
 *
 * @author eproo
 * @date   2017-11-07 09:04:34
 */
public interface InvestorMapper extends GenericMapper< Investor,Integer> {

    @Select("SELECT t.*,u.id AS 'u.id', u.user_name AS 'u.userName',u.mobile AS 'u.mobile', ag.name AS 'ag.name' FROM biz_investor t LEFT JOIN biz_user u ON t.user_id = u.id LEFT JOIN biz_agent ag ON u.agent_id = ag.id WHERE 1 = 1 ${whereSql} ${sortSql} LIMIT ${nowPage}, ${pageSize}")
    List<InvestorModel> findListBySqlJoin(Map<String, Object> params);

    @Select("SELECT count(1)  FROM biz_investor t LEFT JOIN biz_user u ON t.user_id = u.id LEFT JOIN biz_agent ag ON u.agent_id = ag.id WHERE 1=1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);

}
